/**
* @author Saerom Kim <kim79881@gmail.com>
* @version 1.6
* @since 2011-10-16
*/

import java.awt.Color;
import java.util.Arrays;

public class Car{
	public static void main(String[] args){

		Automobile[] fleet=new Automobile[3];
		fleet[0]=new Sedan(Color.black,4);
		fleet[1]=new Minivan(Color.blue,7);
		fleet[2]=new SportsCar(Color.red,2);

		int totalCapacity =0;
		for(int i=0; i<fleet.length; i++){
			if(fleet[i] instanceof Sedan)
				totalCapacity += ((Sedan)fleet[i]).getCapacity();
			else if(fleet[i] instanceof Minivan)
				totalCapacity += ((Minivan)fleet[i]).getCapacity();
			else if(fleet[i] instanceof SportsCar)
				totalCapacity += ((SportsCar)fleet[i]).getCapacity();
			else
				totalCapacity += fleet[i].getCapacity();
		}
		System.out.println("Sedan = "+fleet[0].getCapacity()+
				" Minivan = "+fleet[1].getCapacity()+
				" SportsCar = "+fleet[2].getCapacity()+
				" Total = "+totalCapacity);

		totalCapacity = 0;
		for(int i=0; i<fleet.length; i++){
			totalCapacity += fleet[i].getCapacity();
		}
		System.out.println("Sedan = "+fleet[0].getCapacity()+
				" Minivan = "+fleet[1].getCapacity()+
				" SportsCar = "+fleet[2].getCapacity()+
				" Total = "+totalCapacity);
	}
}
